﻿Imports System.Windows.Forms

Public Class LibComboBox
    Inherits ComboBox

#Region "   Private Members     "
    Private _ClearOnDeleteKey As Boolean = True
#End Region

#Region "   Custom Properties   "

    Public Property ClearOnDeleteKey() As Boolean
        Get
            Return _ClearOnDeleteKey
        End Get
        Set(ByVal value As Boolean)
            _ClearOnDeleteKey = value
        End Set
    End Property

#End Region

    Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Delete And Me._ClearOnDeleteKey Then
            Me.SelectedItem = Nothing
        End If
        MyBase.OnKeyDown(e)
    End Sub

    'Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
    '    Timer1.Enabled = True

    '    MyBase.OnGotFocus(e)
    'End Sub

    'Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
    '    'http://www.macoratti.net/vbn_cbac.htm
    '    ' Reset o timer
    '    Timer1.Start()
    '    MyBase.OnTextChanged(e)
    'End Sub

    'Protected Overrides Sub OnLeave(ByVal e As System.EventArgs)
    '    Timer1.Enabled = False

    '    MyBase.OnLeave(e)
    'End Sub

    'Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    '    Timer1.Enabled = False

    '    If Me.Text.Length > 3 Then
    '        MessageBox.Show("Entrou")
    '    End If
    '    Timer1.Stop()
    '    Timer1.Enabled = True

    'End Sub
End Class
